#!/bin/env python

import time
import cv2
import numpy as np


def mouse_callback(exent, x, y, flags, userdata):
    print(exent, x, y, flags, userdata)

windowName = "mouse"

cv2.namedWindow(windowName, cv2.WINDOW_NORMAL)
cv2.resizeWindow(windowName, 640, 480)

cv2.setMouseCallback(windowName, mouse_callback, "this user data")

img = np.zeros((640, 480, 3), np.uint8)

cv2.imshow(windowName, img)

while True:
    if cv2.waitKey(10) == ord('q'):
        break

print('销毁窗口')
cv2.destroyAllWindows()
